//
//  CardRecordController.m
//  PosApp
//
//  Created by 刘萍 on 2018/9/13.
//  Copyright © 2018年 李英新. All rights reserved.
//

#import "CardRecordController.h"
#import "CardRecordHeadView.h"
#import "CardRecordViewCell.h"

@interface CardRecordController ()<UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
@property (weak, nonatomic) IBOutlet UICollectionView *CardCollectV;

@end

@implementation CardRecordController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.navigationItem.title = @"申卡记录";
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc] init];
    layout.minimumLineSpacing = 0;
    layout.minimumInteritemSpacing = 0;
    layout.itemSize = CGSizeMake(KScreenW/3, 100);
    layout.headerReferenceSize = CGSizeMake(KScreenW, 40);
    
    
    self.CardCollectV.collectionViewLayout = layout;
    self.CardCollectV.delegate = self;
    self.CardCollectV.dataSource = self;
    
    [self.CardCollectV registerNib:[UINib nibWithNibName:@"CardRecordViewCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
    [self.CardCollectV registerNib:[UINib nibWithNibName:@"CardRecordHeadView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"head"];
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 9;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    CardRecordViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
    return cell;
}

- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
    CardRecordHeadView * headV = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"head" forIndexPath:indexPath];
    headV.backgroundColor = KRGBColor(243, 243, 243);
    return headV;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
